home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / SCSI Samples 1.0 / SCSI Driver Example 06⁄07 ƒ / DriverGestalt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-16  |  5.7 KB  |  186 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Wednesday, May 11, 1994 at 11:00 AM
  4.  DriverGestalt.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.  
  8.   Copyright Apple Computer, Inc.  1993-1994
  9.   All rights reserved
  10.   
  11.   This file will eventually be rolled into devices.h
  12.  
  13.         
  14. ************************************************************/
  15.  
  16.  
  17. #ifndef __DRVRGESTALT__
  18. #define __DRVRGESTALT__
  19.  
  20. /* The Driver Gestalt bit in the dCtlFlags */
  21.  
  22. enum {
  23.     DriverGestalt_Enable            = 2,
  24.     
  25.     DriverGestalt_Enable_Mask        = (1 << DriverGestalt_Enable)
  26. };
  27.  
  28. /* New csCodes */
  29. enum {
  30.     csDriverGestaltCode        = 43,        /* various uses */
  31.     csDriverConfigureCode    = 43,        /* various uses */
  32.     csSetStartupDrive        = 44,        /* Control call made to a driver when a user selects a drive in the Startup CP */
  33.     csLowPowerMode            = 70,        /* Sets/Returns the current energy consumption level */
  34.     csReturnDeviceID        = 120,        /* returns SCSI DevID in csParam[0] */
  35.     csGetCDDeviceInfo        = 121        /* returns CDDeviceCharacteristics in csParam[0] */
  36. };
  37.  
  38. /* Currently defined drvrGestalt selectors */
  39. enum {
  40.     driverGestaltSync            = 'sync',    /* True if driver only behaves synchronously. */
  41.     driverGestaltBoot            = 'boot',    /* value to place in PRAM for this drive (long) */
  42.     driverGestaltDeviceType        = 'devt',    /* The type of device the driver is driving. */
  43.     driverGestaltInterface        = 'intf',    /* The underlying interface that the driver is using (if any) */
  44.     driverGestaltVersion        = 'vers',    /* Version number of the driver (numeric part of vers resource) */
  45.     driverGestaltStorage        = 'lpwr'    /* The driver supports the new power saving control/status call */
  46. };
  47.  
  48. /* Structures for currently defined drvrGestalt selectors */
  49.  
  50. struct DriverGestaltSyncResponse
  51. {
  52.     Boolean        behavesSynchronously;
  53. };
  54. typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
  55.  
  56. struct DriverGestaltLpwrResponse
  57. {
  58.     Boolean        supportsLowPower;
  59. };
  60. typedef struct DriverGestaltLpwrResponse DriverGestaltLpwrResponse;
  61.  
  62. struct DriverGestaltBootResponse
  63. {
  64.     unsigned char    extDev;            /*  Packed target (upper 5 bits) LUN (lower 3 bits) */
  65.     unsigned char    partition;        /*  Unused */
  66.     unsigned char    SIMSlot;        /*  Slot */
  67.     unsigned char    SIMsRSRC;        /*  sRsrcID */
  68. };
  69. typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
  70.  
  71. struct DriverGestaltDevTResponse
  72. {
  73.     OSType    deviceType;
  74. };
  75. typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
  76.  
  77.     /* Currently defined values:            */
  78.     /*    'disk'    - standard r/w disk drive     */
  79.     /*    'tape'    - tape drive                 */
  80.     /*    'prnt'    - printer                     */
  81.     /*    'proc'    - processor                 */
  82.     /*    'worm'    - write-once                */
  83.     /*    'cdrm'    - cd-rom drive                */
  84.     /*    'flop'    - floppy disk drive            */
  85.     /*    'scan'    - scanner                    */
  86.  
  87.  
  88. struct DriverGestaltIntfResponse
  89. {
  90.     OSType    interfaceType;
  91. };
  92. typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
  93.  
  94.     /* Currently defined values:            */
  95.     /*    'scsi'                                */
  96.     /*    'pcmc'    - pcmcia                    */
  97.     /*    'ide '                                */
  98.     /*    'pci '                                */
  99.     /*    'nbus'    - nubus card                */
  100.  
  101.  
  102. struct DriverGestaltVersResponse
  103. {
  104.     NumVersion driverVersion;
  105. };
  106. typedef struct DriverGestaltVersResponse DriverGestaltVersResponse;
  107.  
  108.  
  109. /* status parameter block for drvrGestalt calls */
  110. struct DriverGestaltParam {
  111.     ParamBlockHeader 
  112.     short                ioCRefNum;                /* refNum for I/O operation */
  113.     short                csCode;                    /*    == DriverGestaltCode */
  114.     OSType                driverGestaltSelector;    /* 'sync', 'vers', etc. */
  115.     unsigned long                driverGestaltResponse;    /* Could be a pointer, bit field or other format */
  116. };
  117. typedef struct DriverGestaltParam DriverGestaltParam;
  118.  
  119. /* control parameter block for drvrGestalt calls */
  120. struct DriverConfigParam {
  121.     ParamBlockHeader 
  122.     short                ioCRefNum;                /* refNum for I/O operation */
  123.     short                csCode;                    /*    == DriverGestaltCode */
  124.     OSType                driverConfigSelector;    /* the selector */
  125.     unsigned long                driverConfigParameter;    /* Could be a pointer, bit field or other format */
  126. };
  127. typedef struct DriverConfigParam DriverConfigParam;
  128.  
  129. /* Power Saving stuff */
  130.  
  131. enum {
  132.     pmActive        = 0,    /* Normal operation */
  133.     pmStandbay        = 1,    /* Minimal energy saving state, can go active in 5s */
  134.     pmIdle            = 2,    /* Substantial energy savings, can go active in 15s */
  135.     pmSleep            = 3        /* Maximum energy savings, device may be turned off */
  136. };
  137.  
  138. struct LowPowerMode
  139. {
  140.     unsigned char        mode;
  141. };
  142. typedef struct LowPowerMode LowPowerMode;
  143.  
  144.  
  145. /* CD-ROM Specific cs*/
  146.  
  147. struct CDDeviceCharacteristics
  148. {
  149.     unsigned char    speedMajor;            /* High byte of fixed point number containing drive speed */
  150.     unsigned char    speedMinor;            /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
  151.     unsigned short    cdFeatures;            /* Flags field for features and transport type of this CD-ROM */
  152. };
  153. typedef struct CDDeviceCharacteristics CDDeviceCharacteristics;
  154.  
  155. enum
  156. {
  157.     cdFeatureFlagsMask        = 0xFFFC,    /* The Flags are in the first 14 bits of the cdFeatures field */
  158.     cdTransportMask            = 0x0003    /* The transport type is in the last 2 bits of the cdFeatures field */
  159. };
  160.  
  161. enum    /* Flags for CD Feature Flags field */
  162. {
  163.     cdMute                    = 2,    /* The following flags have the same bit number */
  164.     cdLeftPlusRight            = 3,    /* as the Audio Mode they represent.  Don't change */
  165.     cdSCSI_2                = 10,    /* Supports SCSI2 CD Command Set */
  166.     cdStereoVolume            = 11,    /* Can support two different volumes (1 on each channel) */
  167.     cdDisconnect            = 12,    /* Drive supports disconnect/reconnect */
  168.     cdWriteOnce                = 13,    /* Drive is a write/once (CD-R?) type drive */
  169.  
  170.     cdMute_Mask                = 1 << cdMute,
  171.     cdLeftPlusRight_Mask    = 1 << cdLeftPlusRight,
  172.     cdSCSI_2_Mask            = 1 << cdSCSI_2,
  173.     cdStereoVolume_Mask        = 1 << cdStereoVolume,
  174.     cdDisconnect_Mask        = 1 << cdDisconnect,
  175.     cdWriteOnce_Mask        = 1 << cdWriteOnce
  176. };
  177.  
  178. enum    /* Transport types */
  179. {
  180.     cdCaddy                    = 0,    /* CD_SC,CD_SC_PLUS,CD-300 etc. */
  181.     cdTray                    = 1,    /* CD_300_PLUS etc. */
  182.     cdLid                    = 2     /* Power CD - eg no eject mechanism */
  183. };
  184.  
  185. #endif
  186.